var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
    })(t, e);
}, function(t, e) {
    function r() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (r.prototype = e.prototype, 
    new r());
}), a = this && this.__decorate || function(t, e, o, r) {
    var n, i = arguments.length, s = i < 3 ? e : null === r ? r = Object.getOwnPropertyDescriptor(e, o) : r;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(t, e, o, r); else for (var a = t.length - 1; 0 <= a; a--) (n = t[a]) && (s = (i < 3 ? n(s) : 3 < i ? n(e, o, s) : n(e, o)) || s);
    return 3 < i && s && Object.defineProperty(e, o, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("PersonView"), c = e("MyButton"), l = e("GameData"), d = e("LoadManager"), u = cc._decorator, p = u.ccclass, h = u.property, f = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.myButton = null, t.personView = null, t.sprite = null, t.star = null, t.idx = 0, 
        t;
    }
    return i(t, e), t.prototype.start = function() {}, t.prototype.init = function(t, e) {
        switch (t) {
          case 0:
            this.showPerson(e);
            break;

          case 1:
            this.showGun(e);
        }
    }, t.prototype.showPerson = function(e) {
        var t = r.G.personModelList.filter(function(t) {
            return t.id == e;
        });
        if (0 < t.length && (this.idx = e, this.personView.node.active = !0, this.personView.init(e, l.GD.gunIdx), 
        t[0].s > this.star.parent.childrenCount)) for (var o = t[0].s - this.star.parent.childrenCount, n = 0; n < o; n++) cc.instantiate(this.star).parent = this.star.parent;
    }, t.prototype.showGun = function(t) {
        this.idx = t, this.personView.node.active = !1, this.sprite.node.active = !0, d.default.getInstance().loadSpriteFrame({
            url: "image/arm2/" + r.G.getIdxByRank(t),
            sprite: this.sprite
        });
    }, a([ h(c.default) ], t.prototype, "myButton", void 0), a([ h(s.default) ], t.prototype, "personView", void 0), 
    a([ h(cc.Sprite) ], t.prototype, "sprite", void 0), a([ h(cc.Node) ], t.prototype, "star", void 0), 
    a([ p ], t);
}(cc.Component);

n.default = f;